<template>
  <div>
    <h2>我的总资产{{ moneyCount }}</h2>

    <div>
      是不是有钱人<input type="checkbox" name="" id="" :checked="flag" />
      <div style="display: none">
        {{ (flag = moneyCount > 10000 ? true : false) }}
      </div>
    </div>
    <h4>目前状态:{{ moneyCount > 10000 ? '有钱人' : '穷光蛋' }}</h4>
    <div>
      消费项目：
      <button @click="eat">吃饭100</button>
      <button @click="feet">洗脚60</button>
      <button @click="love">约会1000</button>
      <button @click="food">外卖100</button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      moneyCount: 10001,
      flag: true,
    }
  },
  methods: {
    eat() {
      //通过this修改数据
      this.moneyCount -= 100
    },
    feet() {
      this.moneyCount -= 60
    },
    love() {
      this.moneyCount -= 1000
    },
    food() {
      this.moneyCount += 100
    },
  },
}
</script>
